<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class BadlinksController extends AppController {

    var $uses = array(
        'Badlinks'
    );

    function post() {
        $this->autoRender = false;
        $data = $this->data['Badlinks'];
        
        $data['user_created_ip'] = $_SERVER['REMOTE_ADDR'];
        $data['game_id']        =   $data['game_id'];
        $data['params'] = json_encode(apache_request_headers());
        $this->Badlinks->save($data);
        exit;
    }

}
if (!function_exists('apache_request_headers')) {

    function apache_request_headers() {
        foreach ($_SERVER as $key => $value) {
            if (substr($key, 0, 5) == "HTTP_") {
                $key = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5)))));
                $out[$key] = $value;
            }
        }
        return $out;
    }
}
?>
